<?php
	ini_set('display_errors',1);            //错误信息  
	ini_set('display_startup_errors',1);    //php启动错误信息  
	error_reporting(-1); 
	ini_set('error_log', dirname(__FILE__) . '/error3_log.txt');//打印出所有的 错误信息  
	require("config.php");
  	$conn=mysqli_connect($mysql_server_name,$mysql_username,$mysql_password) or die("error connecting");
  	mysqli_query($conn,'set names utf8'); 
  	mysqli_select_db($conn,$mysql_database); 
  	$result = mysqli_query($conn,"select * from sex");
	  $data="";
	  $array= array();
	  class User{
		public $name;
		public $num;
	  }
	 while($row=mysqli_fetch_array($result,MYSQLI_ASSOC)){
		// printf ("%s : %s",$row["name"],$row["num"]);
		 $user=new User();
		 $user->name=$row['name'];
		 $user->num=$row['num'];
		 $array[]=$user;
	 }
	$data=json_encode($array);
	echo $data;
?>